<?php
class Zendhlt_View_Helper_CmsAdvertisement extends Zend_View_Helper_Abstract {
	
	public function cmsAdvertisement($image, $isAdminPage = true, $clickHandler = null) {
		$extension = pathinfo($image);
		$xhtml = "";
		
		if ($extension['extension'] == "swf") {
			$size = '';
			
			/*switch ($position) {
				case 1:
					$size = 'width="486" height="99"';
					break;
				case 2:
					$size = 'width="25%"';
					break;
				case 3:
					$size = 'width="25%"';
					break;
			}*/
			
			$xhtml .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
			$xhtml .= 'codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0"';
			$xhtml .= 'id="adv" ' . $size . '>';
			$xhtml .= '<param name="movie" value="' . $image . '">';
			$xhtml .= '<param name="quality" value="high">';
			$xhtml .= '<param name="wmode" value="transparent">';
			$xhtml .= '<embed name="name" src="' . $image . '"';
			$xhtml .= 'quality="high" wmode="transparent" ' . $size;
			$xhtml .= 'type="application/x-shockwave-flash"';
			$xhtml .= 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?';
			$xhtml .= 'P1_Prod_Version=ShockwaveFlash">';
			$xhtml .= '</embed></object>';
		} else {
			$xhtml .= '<img src="' . $image . '" />';
		}
		
		if (!$isAdminPage) {
			$xhtml = '<span style="cursor:pointer" onclick=\'' . $clickHandler . '\'>' . $xhtml . '</span>';
		}
		
		return $xhtml;
	}
	
}